package fecat.ui.controls;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import fecat.services.ui.UIService;
import fecat.ui.contextpanel.order.*;

public class MainFrame {

	private ExchangeSpinner spinner;
	private JFrame frame;

	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String args[]) {
		try {
			MainFrame window = new MainFrame();
			window.frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the application
	 */
	public MainFrame() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 500, 375);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		spinner = new ExchangeSpinner();
		spinner.setBounds(137, 5, 123, 44);
//		ExchageSpinnerModel esm=new ExchageSpinnerModel();
//		spinner.setModel(esm);
		
//		esm.addChangeListener(new ChangeListener(){
//
//			public void stateChanged(ChangeEvent arg0) {
//				spinner.repaint();
//			}
//			
//		});
//		frame.getContentPane().add(spinner, BorderLayout.NORTH);

		final JButton button = new JButton();
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ModifyOrderDialog modifyOrderDialog=new ModifyOrderDialog(frame);
				modifyOrderDialog.setModal(true);
				modifyOrderDialog.showDialog();
			}
		});
		button.setText("New JButton");
		frame.getContentPane().add(button, BorderLayout.CENTER);

		final JPanel panel = new JPanel();
		panel.setPreferredSize(new Dimension(200, 100));
		panel.setMinimumSize(new Dimension(200, 100));
		panel.setLayout(null);
		panel.add(spinner);
		frame.getContentPane().add(panel, BorderLayout.SOUTH);
	}
	private void getValue(){
		Object obj=spinner.getValue();
		String ss=obj.toString();
	}
}
